Skip to content

bugfix(gameengine): Prevent logic time accumulation while the game is halted#2865

Open
bobtista wants to merge 4 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/fix/logic-time-accumulator-halted
Open

bugfix(gameengine): Prevent logic time accumulation while the game is halted#2865
bobtista wants to merge 4 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/fix/logic-time-accumulator-halted

Conversation

@bobtista

@bobtista bobtista commented Jul 9, 2026

Copy link
Copy Markdown

Since #2803 the update no longer passes FramePacer::IgnoreHaltedGame, so getActualLogicTimeScaleFps returns 0 while the game is paused. That makes targetFrameTime infinite, and m_logicTimeAccumulator banks the entire pause duration, which then drains at render rate after unpausing — the game runs at 2x for about as long as it was paused.

Now returns early when the logic time scale fps is 0, leaving the accumulator untouched while the game is halted, so the game resumes at normal speed.

Todo:

  • Test pause/unpause with render fps 60 and logic time scale 30
  • Replicate to Generals

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR prevents regular game logic from banking paused time while the game is halted.

  • Adds an early zero-or-negative logic FPS guard in Generals.
  • Applies the same guard in Generals Zero Hour.
  • Keeps halted regular-game updates from reaching accumulator timing logic.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/Common/GameEngine.cpp Adds an early return when regular-game logic timing is halted.
GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp Mirrors the halted regular-game logic guard for Zero Hour.

Reviews (2): Last reviewed commit: "bugfix(gameengine): Check for halted gam..." | Re-trigger Greptile

@Caball009 Caball009 self-requested a review July 10, 2026 04:40
@Caball009

Caball009 commented Jul 10, 2026

Copy link
Copy Markdown

It also broke pause on mismatch partially, because fast forward overrides pause now.

Comment thread Generals/Code/GameEngine/Source/Common/GameEngine.cpp Outdated
@Caball009 Caball009 added Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour ThisProject The issue was introduced by this project, or this task is specific to this project Minor Severity: Minor < Major < Critical < Blocker Bug Something is not working right, typically is user facing and removed Major Severity: Minor < Major < Critical < Blocker labels Jul 10, 2026

@Caball009 Caball009 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game logic fast-forwards at render rate after unpausing when the logic time scale is active

3 participants